# -*- coding: ISO-8859-1 -*-
from Tkinter import *
class BarreDeCommande(Frame):
    def __init__(self, v, master,canvas):
        print "(1)"
        Frame.__init__(self, master)
        self.c = canvas
        self.frame = Frame(master,bg="pink")
        self.frame.bind("<Leave>",self.cache)
        self.btn = Button(self.frame,text="Sa marche")
        self.c1 = Canvas(self.frame,bg="black")
        self.btn.pack()
        self.c1.pack()
        self.frame.pack()
        print "(2)"
        
    def affiche(self):
        self.frame.pack()
        
    def cache(self,event):
        print "En theorie on voit de quoi disparraitre!"
        self.c.itemconfigure("panelDroit1", state=HIDDEN)
        
        
 #==============================================================================
 # class BarreDeCommande(Frame):
 #   def __init__(s, v, master):
 #       Frame.__init__(s, master)
 #==============================================================================
        
        #===============================================================================

#        #Scrollbar
#        self.vsb = Scrollbar( self.root, orient = VERTICAL, width = 22, highlightthickness = 5, activebackground = "blue", highlightcolor = "blue", background = "black" )
#        self.hsb = Scrollbar( self.root, orient = HORIZONTAL )
#        #Canvas
#        self.canvasDroite = Canvas( self.root, yscrollcommand = self.vsb.set )
#        self.canvasBas = Canvas( self.root, xscrollcommand = self.hsb.set )
#        #Frame
#        self.frameDroite = Frame( self.canvasDroite )
#        self.frameBas = Frame( self.canvasBas )
#        f = Frame( self.root, relief = "sunken", border = 2, bg = "red" )
#        g = Frame( self.frameDroite, relief = "sunken", border = 2, bg = "black" )
#        b = Frame( self.frameBas, relief = "sunken", border = 2, bg = "red" )
#        f1 = Frame( self.frameBas )
#        f2 = Frame( self.frameBas )
#        f3 = Frame( self.frameBas )
#        f4 = Frame( self.frameBas )
# 
# 
# 
#        #bindings
#        self.root.bind( '<MouseWheel>', self.mouse_wheel )
#        self.canvasDroite.bind( '<Enter>', self.enterCanvasDroit )
#        self.canvasDroite.bind( '<Leave>', self.leaveCanvasDroit )
#        self.canvasBas.bind( '<Enter>', self.enterCanvasBas )
#        self.canvasBas.bind( '<Leave>', self.leaveCanvasBas )
#        self.root.bind( '<Escape>', self.ouvrirFenMenu )
# 
#        #Grid dans la fenetre principale
#        f.grid( column = 0, row = 0, sticky = W + E + N + S )
#        #self.vsb.grid(row=0, column=2, sticky=N+S)
#        self.hsb.grid( row = 3, column = 0, columnspan = 3, sticky = W + E, pady = 5 )
#        #self.canvasDroite.grid(column=1,row=0)
#        self.canvasBas.grid( column = 0, row = 2, columnspan = 3, sticky = W )
# 
#        #Grid dans le frame droit
#        g.grid( column = 0, row = 0, sticky = N )
# 
#        #grid dans le canvas droit
#        self.frameDroite.grid( column = 0, row = 0 )
# 
#        #Grid dans le frame du bas
#        f1.grid( column = 0, row = 0, sticky = W )
#        f2.grid( column = 1, row = 0, sticky = W )
#        f3.grid( column = 2, row = 0, sticky = W )
#        f4.grid( column = 3, row = 0, sticky = W )
# 
#        #grid dans le canvas du bas
#        self.frameBas.grid( column = 0, row = 0, sticky = W )
# 
#        #Configurations des cellules du grid
#        self.root.grid_rowconfigure( 0, weight = 1 )
#        self.root.columnconfigure( 0, weight = 1 )
# 
#        #FrameChat( g )
#        Drag( f )
#        #FrameAireJeu( g )
#        #FrameAireJeu( g )
# 
# 
#        #Config Vertical Scrollbar
#        self.vsb.config( command = self.canvasDroite.yview )
#        self.canvasDroite.create_window( 0, 0, window = self.frameDroite )
#        self.frameDroite.update_idletasks()
#        self.canvasDroite.config( scrollregion = self.canvasDroite.bbox( "all" ) )
#        self.canvasDroite.configure( width = self.frameDroite.winfo_width(), height = self.frameDroite.winfo_height() )
# 
#        #Config Horizontal Scrollbar
#        self.hsb.config( command = self.canvasBas.xview )
#        self.canvasBas.create_window( 0, 0, window = self.frameBas )
#        self.frameBas.update_idletasks()
#        self.canvasBas.config( scrollregion = self.canvasBas.bbox( "all" ) )
#        self.canvasBas.configure( width = self.frameBas.winfo_width(), height = self.frameBas.winfo_height() )
# 
# 
# 
#    def mouse_wheel( self, event ):
#        #Deplacement vers le haut
#        if event.delta > 0:
#            if self.widgetToScroll == self.canvasDroite:
#                self.canvasDroite.yview_scroll( -2, 'units' )
#            elif self.widgetToScroll == self.canvasBas:
#                self.canvasBas.xview_scroll( -2, 'units' )
# 
#        #Deplacement vers le bas
#        else:
#            if self.widgetToScroll == self.canvasDroite:
#                self.canvasDroite.yview_scroll( 2, 'units' )
#            elif self.widgetToScroll == self.canvasBas:
#                self.canvasBas.xview_scroll( 2, 'units' )
# 
#    def enterCanvasBas( self, event ):
#        self.widgetToScroll = self.canvasBas
# 
#    def leaveCanvasBas( self, event ):
#        self.widgetToScroll = None
#===============================================================================